package com.thingcom.delinrobot.base;

import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;

import com.thingcom.delinrobot.R;
import com.thingcom.delinrobot.utils.MyLog;
import com.thingcom.delinrobot.view.SimpleToolbar;

import butterknife.Unbinder;
import me.yokeyword.fragmentation.SupportFragment;

import static com.thingcom.delinrobot.utils.AppUtils.hideSoftKeyboard;

/**
 * author : YuFeng
 * e-mail : 923462992@qq.com
 * date   : 2019/11/4
 */
public class BaseBackFragment extends SupportFragment {
    private static final String TAG = "BaseBackFragment";
    protected Unbinder unbinder;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        MyLog.i(TAG, this.toString() + "----onCreate");
    }

    protected void initToolbarNav(SimpleToolbar toolbar) {
        toolbar.setMyLeftIcon(R.drawable.toolbar_back_selector);
        toolbar.setMinimumHeight(42);
        toolbar.setBackgroundColor(Color.rgb(255, 255, 255));
        toolbar.setLeftIconClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                pop();
            }
        });
    }

    protected void initToolbar(SimpleToolbar toolbar){
        toolbar.setMyLeftIcon(R.drawable.toolbar_back_two_selector);
        toolbar.setMinimumHeight(42);
        toolbar.setBackgroundColor(getResources().getColor(R.color.black_main));
        toolbar.setTitleStyle(getResources().getColor(R.color.white_main),13);
        toolbar.setLeftIconClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                hideSoftKeyboard(_mActivity);
                pop();
            }
        });
    }
}
